package com.app.base.service.core.employees.controller;


import com.app.base.model.dto.HandleInductionDto;
import com.app.base.model.vo.employees.EmployeesListQueryVo;
import com.app.base.model.vo.employees.PostTransferVo;
import com.app.base.model.vo.employees.RemarksVo;
import com.app.base.service.core.employees.service.EmpDetailService;
import com.app.base.utlis.email.Mail;
import com.app.base.utlis.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 员工信息 前端控制器
 * @author yuhag
 * @since 2022-05-11
 */
@RestController
@RequestMapping("/empDetailController")
@Api(tags = "员工管理")
public class EmpDetailController {

    @Resource
    private EmpDetailService empDetailService;

    @PostMapping("handleInduction")
    @ApiOperation("办理入职")
    public Result saveOrUpdateEmp(HttpServletRequest request, @RequestBody HandleInductionDto handleInductionDto){
        return empDetailService.handleInduction(request,handleInductionDto);
    }

    @GetMapping("pageEmpSearch")
    @ApiOperation("员工列表")
    public Result empSearchList(@RequestParam(value = "current" ,defaultValue = "1")  Long current,
                                @RequestParam(value = "pageSize",defaultValue = "10") Long pageSize,
                                EmployeesListQueryVo employeesListQueryVo){
        return empDetailService.empSearchList(current, pageSize,employeesListQueryVo);
    }

    @PostMapping("notice")
    @ApiOperation("邮件通知")
    public Result notice(@RequestBody Mail mail){
        return empDetailService.notice(mail);
    }

    @PostMapping("postTransfer")
    @ApiOperation("调岗")
    public Result postTransfer(@RequestBody PostTransferVo postTransferVo){
        return empDetailService.postTransfer(postTransferVo);
    }

    @PostMapping("editRemarks")
    @ApiOperation("更新备注")
    public Result editRemarks(@RequestBody RemarksVo remarksVo){
        return empDetailService.editRemarks(remarksVo);
    }


}

